package info.motteke.qjdbc.column.variable;

import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * TINYINTに対応します。
 *
 * @author YWak
 *
 */
public final class ByteVariable extends Variable {

    private byte value;

    private boolean set = false;

    public ByteVariable(){

    }

    public ByteVariable(byte value){
        is(value);
    }

    public void is(byte value){
        this.value = value;
        set = true;
    }
    @Override
    void putValue(PreparedStatement pstmt, int index) throws SQLException {
        if(!set){
            throw new IllegalStateException();
        }

        pstmt.setByte(index, value);
    }

}
